This environment may only be started from the Cloud Sandbox
But First, Containers
Containers have been adopted as a great way to alleviate portability issues. Containers form the core of this OpenHack and underpin everything you’ll be exploring as you progress through the challenges.
The objective of this challenge is to ensure you understand the very basics of containers, can work with them locally, and push them to a container image repository.
Challenge
You have been tasked with improving the local development experience for new developers by using Docker to simplify the building, testing, and running of the application. The CTO would also like to see this become part of the integration testing solution of the build pipeline.
Some of the work has been done for you, but it was during a time when teams were split between operations and development, leaving the code split between multiple codebases. The new CTO believes teams should be a mix of both Ops and Dev and has formed the team you are in now (say hi to your fellow teammates at your table :-)).
Building and Testing
Since you’re new to this code base, you’re going to verify at least one of the services still works by building and testing locally. In order to do this, you will need to build and run the Points of Interest (POI) container as well as a SQL Server container. The POI container communicates with the SQL Server container over the Docker network:
To build the POI application, use the TripInsights source code and Dockerfile for each microservice, matching the Dockerfile to the source code.
Tip: If you’re having trouble matching the
Dockerfileto the source code, remember the services are written in different languages. Take a look inside theDockerfile, the corresponding service is more obvious than you think.
After setting up a SQL Server container running locally, add sample data to the database using the following command:
```dockerfile
docker run --network <networkname> -e SQLFQDN=<servername> -e SQLUSER=<db-user> -e SQLPASS=<password> -e SQLDB=mydrivingDB openhack/data-load:v1
```
Tip: The
dataloadimage used in the above command expects a database called “mydrivingDB” to exist already in SQL. Find a way to connect to your running SQL container to create this.
Then configure the POI application to connect to this SQL Server so you can test that the application works. You can find the curl commands to test the applications endpoints in the POI applications README.
IMPORTANT: Set the
ASPNETCORE_ENVIRONMENTenvironment variable in POI toLocal. This configures the application to skip the use of SSL encryption, allowing connection to the local sql server.
Building and Pushing TripInsights Images
Now that you are sure the POI application works, the team must ensure that all of the TripInsights components are built as Docker images and pushed to the team’s Azure Container Registry (ACR). This registry has already been deployed to your Azure Subscription. Reference the Azure Container Registry resource in the Azure portal for registry credentials.
If you choose to test the rest of the images, you can run them locally and send an HTTP GET request to the health endpoint. For example, to hit the POI health endpoint on a container running locally on port 8080, curl or visit in-browser http://localhost:8080/api/poi/healthcheck. Endpoints other than the health endpoint may not be functional at this point (due to dependencies on APIs or the SQL database), so don’t worry if you can’t reach them.
Success Criteria
- Each member of your team must show your coach a locally running Points of Interest (POI) container connected to a running SQL Server container. Verify that your POI container is serving content via HTTP commands. Explain your setup to your coach and how it could be used for development and testing.
- Your team must have built images for all the TripInsights components and pushed them to the team’s ACR. Share your understanding of how each of the images were built and pushed to the registry with your coach.
References
Docker
SQL Server
Azure
Trip Insights Source Code
OpenHack
Hello and welcome to OpenHack, a challenge oriented hack event from Microsoft. You will be presented with a series of challenges, each one more difficult than the one before.
You should already be assigned to and seated with a team, with whom you will attempt to solve as many challenges as you can within today’s hack time.
You have been assigned a coach who will be your first point of contact, and is here to support you and answer questions during the hack. They will not, however, solve the challenges for you.
You may notice a resource group called teamResources in your Azure subscription. This resource group contains any pre-provisioned resources referenced in the challenges.
The Premise
You work for Humongous Insurance. One of their products provides customers the opportunity to qualify for lower car insurance rates. Customers can do this by opting in to use Humongous Insurance’s TripInsights app, which collects data about their driving habits. Your team has been assigned to modernize the application and move it to the cloud.
The TripInsights application, once a monolith, has been refactored into a number of microservices:
- Trip Viewer WebApp (
.NET Core): Your customers use this web application to review their driving scores and trips. The trips are being simulated against the APIs within the OpenHack environment. - Trip API (
Go): The mobile application sends the vehicle’s on-board diagnostics (OBD) trip data to this API to be stored. - Points of Interest API (
.NET Core): This API is used to collect the points of the trip when a hard stop or hard acceleration was detected. - User Profile API (
NodeJS): This API is used by the application to read the user’s profile information. - User API (
Java): This API is used by the application to create and modify the users.
The source code of all the microservices is available here.
The Challenges
Each challenge will lead you through a stage of the technical investigation as briefly laid out by your fictional CTO. These investigations become more technically challenging as you progress.
We do not provide guides or instructions to solve the challenges, just a few hints and documentation references that you may find useful. There are multiple ways to solve each challenge, and very likely some we haven’t thought of. We’re interested in seeing your own unique solutions to each problem, and you should absolutely work with your coaches and the OpenHack Team to validate your solution as correct.
One final tip: Read everything very carefully
The OpenHack team have worked hard to ensure each problem is solvable. All the details you should need are within the challenge briefs, which are very carefully written and worded to give you clues toward the solution. Reading them fully is the best way to figure out a solution, as small points can be easily missed. Your coaches will help to fill gaps in your understanding, provided you ask them the right questions.